import { Injectable } from '@angular/core';
import * as wilddog from 'wilddog';

import { AuthService } from './auth.service';
import { Router } from '@angular/router';

@Injectable()
export class ChartsService {
    // 创建 wilddog 链接
    ref: any;
    // 保存当前用户
    user: any;

    constructor(
        private authService: AuthService,
        private router: Router
    ) {
        // 创建 wilddog 链接
        this.ref = this.authService.LinkWilddog();

        this.user = JSON.parse(localStorage.getItem('KA-U'));
        if (!this.user) {
            this.router.navigateByUrl('/login');
        }
    }

}